﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
///<summary>
///
///</summary>
public class LoginPanel : BasePanel
{
    private void Start()
    {
        //GetUIComponentByName<Button>("BtnStart").onClick.AddListener(ClickStart);
        //GetUIComponentByName<Button>("BtnQuit").onClick.AddListener(ClickQuit);
        //GetUIComponentByName<Button>("BtnSettings").onClick.AddListener(ClickSettings);
    }
   protected override void OnClick(string btnName)
    {
        switch(btnName)
        {
            case "BtnStart":
                Debug.Log("点击开始游戏");
                //显示加载面板
                //然后把LoginPanel隐藏
                UIManager.GetInstance().ShowPanel<LoadingPanel>("LoadingPanel", E_UILayer.Middle, () =>
                {
                    UIManager.GetInstance().HidePanel("LoginPanel");
                });
                //加载主场景
                AsyncOperation ao = SceneManager.LoadSceneAsync(1);
                //做到这里后需要把事件中心模块加进去 , 否则没法做到注册和监听事件 , 这个ao这个值别的脚本就拿不到
                //注册ao
                //LoadingPanel获取ao的值然后调用公共mono模块实时显示Loading进度条
                break;
            case "BtnQuit":
                Debug.Log("点击退出游戏");
                break;
            case "BtnSettings":
                Debug.Log("点击游戏设置");
                break;
        }
    }
}
